package com.yun.controller;

import com.yun.entity.Question;
import com.yun.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @ fileName:HandlerMappingController
 * @ description:
 * @ author:mxt
 * @ createTime:2021/11/25 9:57
 * @ version:1.0.0
 */
@Controller
public class HandlerMappingController {

    @Autowired
    private QuestionService questionService;


    /**
     * @ author: zyk
     * @ description:展示后台测试人员结果
     * @ date: 2021/11/30 20:51
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("showTester")
    public String toShowTester() {
        return "ShowTester";
    }


    /**
     * @ author: zyk
     * @ description:展示后台问题界面
     * @ date: 2021/11/30 20:51
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("showQuestion")
    public String toShowQuestion() {
        return "showQuestion";
    }


    /**
     * @ author: zyk
     * @ description:答题页面
     * @ date: 2021/11/30 20:51
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("ProblemTest")
    public String problemList() {
        return "problemTest";
    }


    /**
     * @ author: zyk
     * @ description:Thanks页面，3秒后跳转注册页面
     * @ date: 2021/11/30 20:50
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("toBack")
    public String toBack() {
        return "thanks";
    }
    /**
     * @ author: zyk
     * @ description:注册页面
     * @ date: 2021/11/30 20:49
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("toLogin")
    public String toLogin() {
        return "index";
    }
    /**
     * @ author: zyk
     * @ description:已放弃的注册页面（仅供学习）
     * @ date: 2021/11/30 20:50
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("toLogin2")
    public String toLogin2() {
        return "login2";
    }


    /**
     * @ author: zyk
     * @ description:layui测试页面(有待优化）
     * @ date: 2021/11/30 20:48
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("toTest")
    public ModelAndView toTest(Integer testerId,ModelAndView modelAndView) {
       //去之前把主键id和题目信息搞过去
        List<Question> questionList = questionService.list();
        modelAndView.addObject("questionList",questionList);
        modelAndView.addObject("testerId",testerId);
        modelAndView.setViewName("test");
        return modelAndView;
        // return "test";
    }

    /**
     * @ author: zyk
     * @ description:后台管理页面
     * @ date: 2021/11/30 20:48
     * @ param: []
     * @ return: java.lang.String
     */
    @RequestMapping("toManage")
    public String toManage() {
        return "manage";
    }

}
